package com.zxl.admin.base;

import com.zxl.common.Result;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author zxw
 * @date 2023/3/31
 */
@Data
@ApiModel("登录结果")
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class LoginResult extends Result {
    @ApiModelProperty("结果")
    private String state;
    @ApiModelProperty("用户账号")
    private String userCode;
    @ApiModelProperty("用户id")
    private Integer userId;

    public LoginResult(Result data, String state, String userCode, Integer userId) {
        this.state = state;
        this.userCode = userCode;
        this.userId = userId;
        this.setCode(data.getCode());
        this.setMessage(data.getMessage());
        this.setSuccess(data.isSuccess());
        this.setData(data.getData());
    }
}
